﻿namespace KingerRobot.MexicoSailunMDC.SpiService;
internal interface IWcsAsrsNetInput
{
    /// <summary>
    /// 开始位获取路线
    /// </summary>
    /// <param name="startLoc"></param>
    /// <returns></returns>
    List<POWcsAsrsNetInput> GetAsrsNetInputByStartLoc(long startLoc);
    /// <summary>
    /// 获取是否有缓存位
    /// </summary>
    /// <param name="startLoc"></param>
    /// <param name="targetLoc"></param>
    /// <returns></returns>
    long GetAsrsNetInputByStartLocTargetLoc(long startLoc, long targetLoc);
    long GetAsrsNetInputByTargetLoc(long targetLoc);
    long GetAsrsNetInputByStartAndTargetLoc(long startLoc, long targetLoc);
    /// <summary>
    /// 测试 通过放胎位查找 立库物料数量
    /// </summary>
    /// <param name="loc"></param>
    /// <param name="materialId"></param>
    /// <returns></returns>
    int GetAsrsNetInputByInputLoc(long loc, long materialId);
    /// <summary>
    /// 入库目标货位
    /// </summary>
    /// <param name="scannerLocId">当前位置</param>
    /// <param name="materialId">物料</param>
    /// <param name="materialCode">物料编码(判断是否位NONE)</param>
    /// <returns></returns>
    long GetAsrsNetInputByStartLocAndNotInCrnIds(long scannerLocId, long materialId,
        List<long> oddNoMaterialCrnIds,
         string materialCode);
    /// <summary>
    /// 入库目标货位V2
    /// </summary>
    /// <param name="startLoc">当前位置</param>
    /// <param name="materialId">物料</param>
    /// <param name="height">高度</param>
    /// <param name="outSide">外径</param>
    /// <param name="materialCode">物料编码(判断是否位NONE)</param>
    /// <param name="notCcrnIds">排除的堆垛机</param>
    /// <returns></returns>
    long GetAsrsNetInputByStartLocAndNotInCrnIdsV2(long scannerLocId, long materialId,
        List<long> oddNoMaterialCrnIds,
         string materialCode);

    /// <summary>
    /// 配对逻辑 入库目标库位
    /// </summary>
    /// <param name="scannerLocId"></param>
    /// <param name="materialCode"></param>
    /// <returns></returns>
    long GetPairAsrsNetInputByStartLocAndNotInCrnIds(long scannerLocId, string materialCode);

    /// <summary>
    /// 物料不一致 送往指定堆垛机
    /// </summary>
    /// <param name="scannerLocId"></param>
    /// <param name="materialCode"></param>
    /// <returns></returns>
    long GetNoPairTargetLoc(long scannerLocId, string materialCode);

    /// <summary>
    /// 判断是否可以通过开始位置到达目标位置
    /// <para name="startLoc">开始位置</para>
    /// <para name="targetLoc">目标位置</para>
    /// </summary>
    /// <returns>true 可以；false 不可以</returns>
    bool IfStartLocToTargetLoc(long startLoc, long targetLoc);

    /// <summary>
    /// 数量是否超限
    /// </summary>
    /// <param name="crnId"></param>
    /// <param name="areaId"></param>
    /// <returns></returns>
    bool IsCrnTaskCounts(long crnId, long areaId);
}

internal class AreaSort
{
    public long AreaId { get; set; }
    public int Sort { get; set; }
}
internal class CrnSort
{
    public long CrnId { get; set; }
    public int Sort { get; set; }
}
public class AsrsInfoBean
{
    public long TargetLoc { get; set; }
}
public class CrnTaskCount
{
    public long? CrnId { get; set; }
    public long? AreaId { get; set; }
    public int MaxCount { get; set; }
    public int Count { get; set; }
}